package com.coffeeloversupportlibrary.coffeelover;

import com.coffeeloversupportlibrary.coffeelover.contentshow.entity.OriginArticleDetails;
import com.coffeeloversupportlibrary.coffeelover.domain.article.entity.Article;
import com.coffeeloversupportlibrary.coffeelover.domain.article.entity.OriginData;
import com.coffeeloversupportlibrary.coffeelover.domain.dailyshare.entity.share.OriginDailyContent;
import com.coffeeloversupportlibrary.coffeelover.domain.dailyshare.share.entity.OriginShareImageUrl;
import com.coffeeloversupportlibrary.coffeelover.domain.dailyshare.share.entity.UpLoadResponse;
import com.coffeeloversupportlibrary.coffeelover.domain.explor.entity.DialogOrigin;
import com.coffeeloversupportlibrary.coffeelover.domain.explor.entity.HomeOrigin;

import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Path;

/**
 * @author puyv
 * @createTime 2021/11/5 16:37
 * @projectName CoffeeLoverSupportLibrary
 * @className ApiService.java
 * @description 网络服务接口
 */
public interface ApiService {
    //http://v.juhe.cn/   toutiao/index?type=top&key=a22dcca091c794c204faeeb889a73cd3
    //a22dcca091c794c204faeeb889a73cd3
//    @FormUrlEncoded
//    @POST("toutiao/index")
//    Call<Beans> requestTest(@Field("type") String type, @Field("key") String key);
    //todo:  bug描述：出现Bug前使用的是post请求，返回的 Articles 不为空，但是通过logcat 获取到message 信息执行了全局异常处理
    //todo: 看上去好像是从响应体中拿到的body Articles message属性是空的 --从另外一个角度将 resfuln风格 get post 请求的区别推测产生Bug
    //todo: 的原因应该是使用了post 代表推送数据 而不会获得数据 所以改为get bug 得以解决
//    @GET("article/getArticle/{id}")
//    Call<Articles> requestTest(@Path("id") String id);

//    public interface BlogService {
//        @GET("blog/{id}")
//        Call<ResponseBody> getBlog(@Path("id") int id);
//    }
    //http://10.7.86.187:8001/article/articleList
//@Headers({
//        "Accept: application/vnd.github.v3.full+json",
//        "User-Agent: Retrofit-Sample-App"
//})
//
    //http://10.7.88.9:8001/article/articleList
//    @Headers({"Accept:application/json"})
    @GET("article/articleList/")
//    @Header("Accept") String header
    Call<OriginData>  requestArticleList();

    //或者 @Header("Accept")---数据转化问题解决后 header 参数可加 可不加

//    http://10.7.88.9:8001/article/ariticleByType/1

    @GET("article/ariticleByType/{type}")
    Call<OriginData> requestArticleByType(@Path("type") int type);


    //http://10.7.90.92:8001/article/getArticle/283e834c-e314-42f2-9ef3-dca8bb62c07e
    @GET("article/getArticle/{id}")
    Call<OriginArticleDetails> requestArticleDetails(@Path("id") String id);

    // TODO: 2021/11/23 为所有请求写 请求头
    //http://10.7.88.9:8002/share/coffee/shareList
    @GET("share/shareList")
    Call<OriginDailyContent> requestShareList();

    // TODO: 2021/11/27   作废 
    @POST("/eduoss/fileoss")
    Call<OriginShareImageUrl>  postShareImage(@Body RequestBody body);
    //http://10.7.88.9:8002/share/coffee/shareInfo


    //http://turing.gz2vip.91tunnel.com/share/coffee/shareInfo

    @POST("share/shareInfo")
    Call<UpLoadResponse> upLoadShare(@Body RequestBody body);

//    http://10.7.88.9:8005/game/commend/begin/1

    @GET("tree/commend/begin/{type}")
    Call<HomeOrigin> startDialog(@Path("type") int type);

    @GET("tree/commend/content/{id}")
    Call<DialogOrigin> dialog(@Path("id") int id);

}

